package com.ruoyi.his.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.his.mapper.HisDepartmentMapper;
import com.ruoyi.his.domain.HisDepartment;
import com.ruoyi.his.service.IHisDepartmentService;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author Alan
 * @date 2024-03-20
 */
@Service
public class HisDepartmentServiceImpl implements IHisDepartmentService
{
    @Autowired
    private HisDepartmentMapper hisDepartmentMapper;

    /**
     * 查询【请填写功能名称】
     *
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public HisDepartment selectHisDepartmentById(Long id)
    {
        return hisDepartmentMapper.selectHisDepartmentById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param hisDepartment 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<HisDepartment> selectHisDepartmentList(HisDepartment hisDepartment)
    {
        return hisDepartmentMapper.selectHisDepartmentList(hisDepartment);
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param hisDepartment 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertHisDepartment(HisDepartment hisDepartment)
    {
        return hisDepartmentMapper.insertHisDepartment(hisDepartment);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param hisDepartment 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateHisDepartment(HisDepartment hisDepartment)
    {
        return hisDepartmentMapper.updateHisDepartment(hisDepartment);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param ids 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteHisDepartmentByIds(Long[] ids)
    {
        return hisDepartmentMapper.deleteHisDepartmentByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteHisDepartmentById(Long id)
    {
        return hisDepartmentMapper.deleteHisDepartmentById(id);
    }

    //获取设备id
    @Override
    public String getDeviceId(String channelId) {
         String deviceId = hisDepartmentMapper.getDeviceId(channelId);
        return deviceId;
    }

    @Override
    public List<HisDepartment> getDpartment(HisDepartment hisDepartment) {
        List<HisDepartment> dpartment =new ArrayList<>();
        if (StringUtils.isNotEmpty(hisDepartment.getSignature())&&StringUtils.isNotEmpty(hisDepartment.getHospitalId())) {
           dpartment = hisDepartmentMapper.getDpartment(hisDepartment);
        }
        return dpartment;
    }
}
